import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/standardiztion/standard_risk_mgmt_ctrl_entity.dart';

StandardRiskMgmtCtrlEntity $StandardRiskMgmtCtrlEntityFromJson(Map<String, dynamic> json) {
  final StandardRiskMgmtCtrlEntity standardRiskMgmtCtrlEntity = StandardRiskMgmtCtrlEntity();
  final List<StandardRiskMgmtCtrlAmendmentList>? amendmentList = (json['amendmentList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<StandardRiskMgmtCtrlAmendmentList>(e) as StandardRiskMgmtCtrlAmendmentList).toList();
  if (amendmentList != null) {
    standardRiskMgmtCtrlEntity.amendmentList = amendmentList;
  }
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    standardRiskMgmtCtrlEntity.code = code;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    standardRiskMgmtCtrlEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    standardRiskMgmtCtrlEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    standardRiskMgmtCtrlEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    standardRiskMgmtCtrlEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    standardRiskMgmtCtrlEntity.deleted = deleted;
  }
  final String? departmentId = jsonConvert.convert<String>(json['departmentId']);
  if (departmentId != null) {
    standardRiskMgmtCtrlEntity.departmentId = departmentId;
  }
  final String? fileAddressUrl = jsonConvert.convert<String>(json['fileAddressUrl']);
  if (fileAddressUrl != null) {
    standardRiskMgmtCtrlEntity.fileAddressUrl = fileAddressUrl;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    standardRiskMgmtCtrlEntity.id = id;
  }
  final String? relevantDepartments = jsonConvert.convert<String>(json['relevantDepartments']);
  if (relevantDepartments != null) {
    standardRiskMgmtCtrlEntity.relevantDepartments = relevantDepartments;
  }
  final String? reviewedBy = jsonConvert.convert<String>(json['reviewedBy']);
  if (reviewedBy != null) {
    standardRiskMgmtCtrlEntity.reviewedBy = reviewedBy;
  }
  final int? saveYear = jsonConvert.convert<int>(json['saveYear']);
  if (saveYear != null) {
    standardRiskMgmtCtrlEntity.saveYear = saveYear;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    standardRiskMgmtCtrlEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    standardRiskMgmtCtrlEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    standardRiskMgmtCtrlEntity.updateDate = updateDate;
  }
  return standardRiskMgmtCtrlEntity;
}

Map<String, dynamic> $StandardRiskMgmtCtrlEntityToJson(StandardRiskMgmtCtrlEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['amendmentList'] = entity.amendmentList?.map((v) => v.toJson()).toList();
  data['code'] = entity.code;
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['departmentId'] = entity.departmentId;
  data['fileAddressUrl'] = entity.fileAddressUrl;
  data['id'] = entity.id;
  data['relevantDepartments'] = entity.relevantDepartments;
  data['reviewedBy'] = entity.reviewedBy;
  data['saveYear'] = entity.saveYear;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension StandardRiskMgmtCtrlEntityExtension on StandardRiskMgmtCtrlEntity {
  StandardRiskMgmtCtrlEntity copyWith({
    List<StandardRiskMgmtCtrlAmendmentList>? amendmentList,
    String? code,
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? departmentId,
    String? fileAddressUrl,
    String? id,
    String? relevantDepartments,
    String? reviewedBy,
    int? saveYear,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return StandardRiskMgmtCtrlEntity()
      ..amendmentList = amendmentList ?? this.amendmentList
      ..code = code ?? this.code
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..departmentId = departmentId ?? this.departmentId
      ..fileAddressUrl = fileAddressUrl ?? this.fileAddressUrl
      ..id = id ?? this.id
      ..relevantDepartments = relevantDepartments ?? this.relevantDepartments
      ..reviewedBy = reviewedBy ?? this.reviewedBy
      ..saveYear = saveYear ?? this.saveYear
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}

StandardRiskMgmtCtrlAmendmentList $StandardRiskMgmtCtrlAmendmentListFromJson(Map<String, dynamic> json) {
  final StandardRiskMgmtCtrlAmendmentList standardRiskMgmtCtrlAmendmentList = StandardRiskMgmtCtrlAmendmentList();
  final String? amendmentDate = jsonConvert.convert<String>(json['amendmentDate']);
  if (amendmentDate != null) {
    standardRiskMgmtCtrlAmendmentList.amendmentDate = amendmentDate;
  }
  final String? amendmentUser = jsonConvert.convert<String>(json['amendmentUser']);
  if (amendmentUser != null) {
    standardRiskMgmtCtrlAmendmentList.amendmentUser = amendmentUser;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    standardRiskMgmtCtrlAmendmentList.companyCode = companyCode;
  }
  final String? correlationId = jsonConvert.convert<String>(json['correlationId']);
  if (correlationId != null) {
    standardRiskMgmtCtrlAmendmentList.correlationId = correlationId;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    standardRiskMgmtCtrlAmendmentList.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    standardRiskMgmtCtrlAmendmentList.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    standardRiskMgmtCtrlAmendmentList.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    standardRiskMgmtCtrlAmendmentList.deleted = deleted;
  }
  final String? fileAddressUrl = jsonConvert.convert<String>(json['fileAddressUrl']);
  if (fileAddressUrl != null) {
    standardRiskMgmtCtrlAmendmentList.fileAddressUrl = fileAddressUrl;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    standardRiskMgmtCtrlAmendmentList.id = id;
  }
  final String? sort = jsonConvert.convert<String>(json['sort']);
  if (sort != null) {
    standardRiskMgmtCtrlAmendmentList.sort = sort;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    standardRiskMgmtCtrlAmendmentList.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    standardRiskMgmtCtrlAmendmentList.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    standardRiskMgmtCtrlAmendmentList.updateDate = updateDate;
  }
  return standardRiskMgmtCtrlAmendmentList;
}

Map<String, dynamic> $StandardRiskMgmtCtrlAmendmentListToJson(StandardRiskMgmtCtrlAmendmentList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['amendmentDate'] = entity.amendmentDate;
  data['amendmentUser'] = entity.amendmentUser;
  data['companyCode'] = entity.companyCode;
  data['correlationId'] = entity.correlationId;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['fileAddressUrl'] = entity.fileAddressUrl;
  data['id'] = entity.id;
  data['sort'] = entity.sort;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension StandardRiskMgmtCtrlAmendmentListExtension on StandardRiskMgmtCtrlAmendmentList {
  StandardRiskMgmtCtrlAmendmentList copyWith({
    String? amendmentDate,
    String? amendmentUser,
    String? companyCode,
    String? correlationId,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? fileAddressUrl,
    String? id,
    String? sort,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return StandardRiskMgmtCtrlAmendmentList()
      ..amendmentDate = amendmentDate ?? this.amendmentDate
      ..amendmentUser = amendmentUser ?? this.amendmentUser
      ..companyCode = companyCode ?? this.companyCode
      ..correlationId = correlationId ?? this.correlationId
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..fileAddressUrl = fileAddressUrl ?? this.fileAddressUrl
      ..id = id ?? this.id
      ..sort = sort ?? this.sort
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}
